import React, { createContext, useState, useImperativeHandle, forwardRef, useEffect } from 'react';
import './index.less';
import Configuration from './components/configuration';
import RenderSettiing from './components/RenderSetting';
import entryData from './../../content';
const DataEntry = (props, ref) => {
  const { defaultData } = props;
  useImperativeHandle(ref, () => {
    return {
      fetchData: data,
    };
  });
  useEffect(() => {
    setData(defaultData);
  }, [defaultData]);
  const [data, setData] = useState([]);
  return (
    <entryData.Provider value={{ data: data, setData: setData }}>
      <div className="dataEntry_box">
        <Configuration></Configuration>
        <RenderSettiing></RenderSettiing>
      </div>
    </entryData.Provider>
  );
};
export default forwardRef(DataEntry);
